<template>
  <div class="dashboard-editor-container">
    <panel-group/>

    <el-row style="background: #fff; padding: 16px 16px 0; margin-bottom: 32px">
      <line-chart :chart-data="lineChartData"/>
    </el-row>
  </div>
</template>

<script>
import PanelGroup from "./dashboard/PanelGroup";
import LineChart from "./dashboard/LineChart";
import {getMonthCount} from "@/api/index";

const lineChartData = {
  newVisitis: {
    expectedData: [],
    dayData: [],
  },
};

export default {
  name: "Index",
  components: {
    PanelGroup,
    LineChart,
  },
  data() {
    return {
      lineChartData: lineChartData.newVisitis,
    };
  },
  created() {
    getMonthCount().then(res => {
      let arr = [];
      let arr2 = [];
      res.data.forEach((item) => {
        arr.push(item.count);
        arr2.push(item.month);
      });
      lineChartData.newVisitis.expectedData = arr;
      lineChartData.newVisitis.dayData = arr2;
    })
  },
  methods: {
  },
};
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width: 1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
